Skip to content

Add property ryuk.disabled#11414

Closed
joca-bt wants to merge 1 commit intotestcontainers:mainfrom
joca-bt:main
Closed

Add property ryuk.disabled#11414
joca-bt wants to merge 1 commit intotestcontainers:mainfrom
joca-bt:main

Conversation

@joca-bt
Copy link

@joca-bt joca-bt commented Jan 5, 2026

This allows disabling the Ryuk container via a property, while being backwards compatible with the existing environment variable.

Solves #11413.

@joca-bt joca-bt requested a review from a team as a code owner January 5, 2026 15:56
@joca-bt joca-bt changed the title Add property ryuk.disabled. Add property ryuk.disabled Jan 5, 2026
@joca-bt
Copy link
Author

joca-bt commented Jan 7, 2026

@eddumelendez can you a look at this? Needs a workflow approval to run CI.

This allows disabling the Ryuk container via a property, while being backwards
compatible with the existing environment variable.

Solves testcontainers#11413.
@eddumelendez
Copy link
Member

Hi, you can achieve the same goal configuring your build tool

Maven

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <environmentVariables>
            <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
        </environmentVariables>
    </configuration>
</plugin>

Gradle

tasks.named("test", Test) {
  environment "TESTCONTAINERS_RYUK_DISABLED", "true"
}

@joca-bt
Copy link
Author

joca-bt commented Feb 3, 2026

We don't use either of these build tools (we are on Bazel) and it's easier (and better) to do it via the testcontainers.properties file.

This property is backwards compatible with the other properties following the testcontainers guidelines.

@eddumelendez
Copy link
Member

There are other reason why we are not supporting this in the property file that I am no recalling right now, but, will share later.

@eddumelendez
Copy link
Member

See #4950 (comment)

@joca-bt
Copy link
Author

joca-bt commented Feb 3, 2026

Our CI environment cannot run privileged containers, and we have a significant number of users running rootless Docker/Podman where Ryuk can be problematic. My understanding from the documentation is that Ryuk is supposed to be optional.

Supporting this configuration via the properties file simplifies centralized governance. For example, we maintain a central testing library that configures Testcontainers for a specific use case. Managing this configuration via a properties file within this library is significantly more maintainable than having to add the corresponding environment variable in all relevant test targets.

Unless I misunderstood, there doesn't seem to be a strong reason to not support this as a property in the thread you shared. This PR is following the established configuration guidelines and doesn't change the existing behaviour for the broader community. It provides a standard alternative for environments where environment variables are "expensive" to manage or the running environment is more restrictive.

On another note, it seems that this request comes every now and then, and it seems to be one of the few configuration properties that is only available as an environment variable.

@joca-bt
Copy link
Author

joca-bt commented Feb 3, 2026

This property exists for Go.

https://golang.testcontainers.org/features/configuration/#customizing-ryuk-the-resource-reaper

If your environment already implements automatic cleanup of containers after the execution, but does not allow starting privileged containers, you can turn off the Ryuk container by setting TESTCONTAINERS_RYUK_DISABLED environment variable, or the ryuk.disabled property to true.

Maybe we can bridge this gap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants